# -*- coding: utf-8 -*-
import time
from selenium import webdriver
import unittest
import xlrd
from venv1.Page.loginPage import loginPage
from venv1.publicModule.login import login
from venv1.Page.inqueryPage import inqueryPage
from venv1.publicModule.inquery import inquery
class Inquery_Case(unittest.TestCase):
    @classmethod
    def setUpClass(self):
        self.driver = webdriver.Chrome()
        self.driver.implicitly_wait(10)
        self.driver.maximize_window()
        self.driver.get("http://10.22.26.74:8080/dist/index.html#/")
        time.sleep(2)
        self.loginPage = loginPage(self.driver)
        self.login = login(self.driver)
        self.inqueryPage=inqueryPage(self.driver)
        self.inquery=inquery(self.driver)
    def test01(self):
        filename= r'..\TestData\Data.xls'
        excel_open=xlrd.open_workbook(filename)
        table=excel_open.sheet_by_name('Sheet1')
        rows=table.nrows
        for i in range(2,rows):
            row_content=table.row_values(i)
            username=row_content[0]
            password=row_content[1]
            login.login(self,username,password)
    def test02(self):
        filename = r'..\TestData\Data.xls'
        excel_open = xlrd.open_workbook(filename)
        table = excel_open.sheet_by_name('Sheet1')
        rows = table.nrows
        for i in range(2, rows):
            row_content = table.row_values(i)
            PolicyNo = row_content[3]
            inquery.Assign_To(self,PolicyNo)

if __name__ == '__main__':
    suite = unittest.TestLoader.loadTestsFromTestCase(Inquery_Case)
    unittest.TextTestRunner().run(suite)

